package com.zhibo.util;

import org.solar.util.PropertiesUtil;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.Map;

/**
 * Created by xianchuanwu on 2017/9/24.
 */
public class Config {
    private static Map map=PropertiesUtil.getProperty("config.txt");
//    static{
//        map.putAll(PropertiesUtil.getProperty("file:/ssp-config.txt"));
//    }
    public static final String appId=(String)map.get("appId");
    public static final String baseHost=(String)map.get("baseHost");
    public static final String aesPassword=(String)map.get("aesPassword");
    public static final String rsaPrivateKey=(String)map.get("rsaPrivateKey");
    public static final String rsaPublicKey=(String)map.get("rsaPublicKey");
    public static final String wechatAppId=(String)map.get("wechatAppId");
    public static final String wechatSecret=(String)map.get("wechatSecret");
    public static final String storeWechatAppId=(String)map.get("storeWechatAppId");
    public static final String storeWechatSecret=(String)map.get("storeWechatSecret");
//    public static final String wechatPayAppId=(String)map.get("wechatPayAppId");
    public static final String wechatPayMchId=(String)map.get("wechatPayMchId");
    public static final String wechatPayKey=(String)map.get("wechatPayKey");
    public static final String wechatPayNotifyUrl=(String)map.get("wechatPayNotifyUrl");
    //alipay
    // 商户appid
    public static String alipayAppId =(String)map.get("alipayAppId");
    // 私钥 pkcs8格式的
    public static String alipayRsaPrivateKey =(String)map.get("alipayRsaPrivateKey");
    // 服务器异步通知页面路径 需http://或者https://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String alipayNotifyUrl =(String)map.get("alipayNotifyUrl");
    // 页面跳转同步通知页面路径 需http://或者https://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问 商户可以自定义同步跳转地址
    public static String alipayReturnUrl = (String)map.get("alipayReturnUrl");
    public static String alipayPublicKey =(String)map.get("alipayPublicKey");
    public static String get(String key) {
        return (String)map.get(key);
    }

    public static String getClassPath( ) {
        String path=Config.class.getResource("/").getPath();
        try {
            path= URLDecoder.decode(path,"utf-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return path;
    }
}
